<?php 
$name = $_POST['name'];
$message = $_POST['message'];
$ctime = time();
@mysql_connect('localhost','root','root');
if (mysql_errno()) {
	die(mysql_error());
}
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "insert into `message` (`name`,`message`,`ctime`) values ('$name','$message','$ctime')";
$res = mysql_query($sql);
if ($res) {
    echo "<script>alert('添加成功');window.location.href='index.php'</script>";
} else {
    echo "<script>alert('添加失败');window.location.href='add.php'</script>";
}
 ?>